﻿using mozhi.smarterp.Finance.Basedatas.Services;
using mozhi.smarterp.Finance.Enums;
using mozhi.smarterp.Finance.Finances.Repository;
using mozhi.smarterp.Finance.Querys;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Volo.Abp.Guids;

namespace mozhi.smarterp.Finance.Finances.Services
{
    public class JournalTemplateManager : DomainService
    {
        private IJournalTemplateRepository _repository;
        private IGuidGenerator _guidGenerator;
        
        public JournalTemplateManager(IJournalTemplateRepository repository , IGuidGenerator guidGenerator)
        {
            _repository = repository;
            _guidGenerator = guidGenerator;
        }

        public async Task<JournalTemplate> CreateAsync(DocumentType documentType , string comment , Guid numberPrefixId)
        {
            //var duplicationCount = await _repository.GetCountAsync(new PageQuery() { Keyword = documentType.ToString() });

            //if (duplicationCount > 0)
            //    throw new UserFriendlyException("凭证模板编号已存在", "100000");

            //var template = new JournalTemplate(_guidGenerator.Create(), comment, numberPrefixId);

            //return template;
            throw new NotImplementedException();
        }
    }
}
